<template>
	<view class="padding-bottom-xl min-h-100" :class="dataList.length > 0 ? 'bg-gray':''">
		<view class="p-t-10 p-l-10 p-r-10">
			<view class="p-20 border-box bg-white m-b-10 b-r-10" v-for="(item,index) in dataList" :key="index">
				<view class="p-10 flex justify-between">
					<view class="font-14 color-gray">申请时间:{{ item.createTime }}</view>
					<view class="font-13 color-r box1">{{ item.stateApply | getStatusValue(statusList)}}</view>
				</view>
				<view class="p-10 flex justify-between">
					<view class="font-14 color-gray">店铺名称</view>
					<view class="font-13">{{ item.storeName }}</view>
				</view>
				<view class="p-10 flex justify-between">
					<view class="font-14 color-gray">店铺logo</view>
					<view class="flex-1 flex justify-end">
						<image class="imgBox" :src="item.logo" @click="lookImg(item.logo)"></image>
					</view>
				</view>
				<view class="p-10 flex justify-between">
					<view class="font-14 color-gray">审核时间</view>
					<view class="font-13">{{ item.applyTime }}</view>
				</view>
				<view class="p-10 flex justify-between">
					<view class="font-14 color-gray">审核备注</view>
					<view class="font-13">{{ item.applyRemark }}</view>
				</view>
				<view class="flex justify-between m-t-10">
					<view class="color-r" @click="clickData(item,1)">查看详情</view>
					<view class="btn line-h-60 b-r-10 color-w text-center" v-if="item.stateApply == 3" @click="clickData(item,2)">重新提交</view>
				</view>
			</view>
			<view class="flex flex-col flex-row-center flex-col-center m-b-20" v-if="dataList.length == 0">
				<image src="@/static/index/no-data.png"></image>
				<view class="color-g font-12 text-center w-100">暂无数据...</view>
			</view>
		</view>
	</view>
</template>
<script>
	import { joinDataList } from '@/common/api/join.js'
	export default {
		data() {
			return {
				statusList: [
					{label: 1,value: '审核中'},
					{label: 2,value: '审核通过'},
					{label: 3,value: '审核驳回'}
				],
				dataList:[],  //列表数据
			};
		},
		filters: {
			getStatusValue(val,list) {
				let obj = list.find(item => item.label == val);
				return JSON.stringify(obj) !== "{}" ? obj.value : '';
			}
		},
		onShow() {
			this.loadVoucherRecondInfo()
		},
		methods: {
			// 预览图片 
			lookImg(url){
				uni.previewImage({
					urls: [url]
				});
			},
			// 获取历史提交
			loadVoucherRecondInfo() {
				joinDataList().then( res => {
					if(res.code == 200){
						this.dataList = res.data
					}
				})
			},
			// 点击跳转详情
			clickData(data,type){
				uni.setStorageSync('storeJoinInfo',data)
				uni.navigateTo({
					url: '/pages/my/join/index?data='+type
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.imgBg{
	width: 100%;
	height: 190rpx;
}
.min-h-100{
	min-height: 100vh;
}
.imgBox{
	width: 100rpx;
	height: 100rpx;
}
.box1{
	border: 1rpx solid #e60000;
	padding: 2rpx 10rpx;
	border-radius: 10rpx;
}
.btn{
	width: 240rpx;
	background: #e60000;
}
</style>